package game.http;

import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;

import org.springframework.stereotype.Component;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;

@Component
public class MyHandler implements HttpHandler {

	@Override
	public void handle(HttpExchange httpexchnge) throws IOException {
		httpexchnge.getRequestBody();
		String response = "<h3>Happy New Year 2007!--Soddabao</h3>";
		httpexchnge.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.length());
		OutputStream os = httpexchnge.getResponseBody();
		os.write(response.getBytes());
		os.close();
	}

}
